package sam.learn.biz.datasource.repo.entity;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

@TableName("datasource_info")
public class DatasourceInfo {


    /**
     * datasource_id
     */
    @TableId(type = IdType.AUTO)
    private Integer datasourceId;

    /**
     * region_code
     */
    private String regionCode;

    /**
     * 中文名称
     */
    private String aliasName;

    /**
     * ip
     */
    private String ip;

    /**
     * port
     */
    private String port;

    /**
     * schema
     */
    @TableField("`schema`")
    private String schema;

    /**
     * username
     */
    private String user;

    /**
     * password
     */
    private String pwd;

    /**
     * mariadb;mysql5,mysql8
     */
    private String brand;

    public DatasourceInfo() {
    }

    private DatasourceInfo(Builder builder) {
        setDatasourceId(builder.datasourceId);
        setRegionCode(builder.regionCode);
        setAliasName(builder.aliasName);
        setIp(builder.ip);
        setPort(builder.port);
        setSchema(builder.schema);
        setUser(builder.user);
        setPwd(builder.pwd);
        setBrand(builder.brand);
    }


    public Integer getDatasourceId() {
        return datasourceId;
    }

    public void setDatasourceId(Integer datasourceId) {
        this.datasourceId = datasourceId;
    }

    public String getRegionCode() {
        return regionCode;
    }

    public void setRegionCode(String regionCode) {
        this.regionCode = regionCode;
    }

    public String getAliasName() {
        return aliasName;
    }

    public void setAliasName(String aliasName) {
        this.aliasName = aliasName;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getPort() {
        return port;
    }

    public void setPort(String port) {
        this.port = port;
    }

    public String getSchema() {
        return schema;
    }

    public void setSchema(String schema) {
        this.schema = schema;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }


    public static final class Builder {
        private Integer datasourceId;
        private String regionCode;
        private String aliasName;
        private String ip;
        private String port;
        private String schema;
        private String user;
        private String pwd;
        private String brand;

        private Builder() {
        }

        public static Builder newBuilder() {
            return new Builder();
        }

        public Builder datasourceId(Integer val) {
            datasourceId = val;
            return this;
        }

        public Builder regionCode(String val) {
            regionCode = val;
            return this;
        }

        public Builder aliasName(String val) {
            aliasName = val;
            return this;
        }

        public Builder ip(String val) {
            ip = val;
            return this;
        }

        public Builder port(String val) {
            port = val;
            return this;
        }

        public Builder schema(String val) {
            schema = val;
            return this;
        }

        public Builder user(String val) {
            user = val;
            return this;
        }

        public Builder pwd(String val) {
            pwd = val;
            return this;
        }

        public Builder brand(String val) {
            brand = val;
            return this;
        }

        public DatasourceInfo build() {
            return new DatasourceInfo(this);
        }
    }

    @Override
    public String toString() {
        return "DatasourceInfo{" +
                "datasourceId=" + datasourceId +
                ", regionCode='" + regionCode + '\'' +
                ", aliasName='" + aliasName + '\'' +
                ", ip='" + ip + '\'' +
                ", port='" + port + '\'' +
                ", schema='" + schema + '\'' +
                ", user='" + user + '\'' +
                ", pwd='" + pwd + '\'' +
                ", brand='" + brand + '\'' +
                '}';
    }


}
